package com.oren.Thread.study.day02;

/**
 * Created by IntelliJ IDEA.
 * User: wangshiwei
 * Date: 2018/8/6
 * Time: 13:41
 * describe:
 */
public class HasSelPrivateNum {

    private int num=0;

    public synchronized void addI(String username){
        try {
            if(username.equals("a")){
                num=100;
                System.out.println("a set over");
                Thread.sleep(2000);
            }else {
                num = 200;
                System.out.println("b set over");;
            }
            System.out.println(username+ "num ="+num);
        }catch (Exception e){
            e.printStackTrace();

        }

    }

}
